package com.han.methodlog.service.impl;

import com.han.methodlog.config.QueueConfig;
import com.han.methodlog.entity.Email;
import com.han.methodlog.service.EmailRetryService;
import org.springframework.stereotype.Service;

import java.util.concurrent.BlockingQueue;

@Service
public class EmailRetryServiceImpl implements EmailRetryService {

    private final QueueConfig queueConfig;

    public EmailRetryServiceImpl(QueueConfig queueConfig) {
        this.queueConfig = queueConfig;
    }

    @Override
    public void saveEmailToQueue(Email email) {
        BlockingQueue<Email> emails = queueConfig.emailRetryQueue();
        emails.add(email);
    }
}
